<template>
    <div class="big-box">
        <div class="header">
            <img src="../../../../../assets/bigScreen/header4.png" alt="" />
            <div class="backBox" @click="goBack"></div>
        </div>
        <div class="backToBox">
            <div class="backTo" @click="gotoHome">
                <div>返回总窗口</div>
            </div>
            <div class="backTo" @click="backToOne">
                <div>返回上一页</div>
            </div>
        </div>
        <div class="centerBox">
            <div class="sreenTitle">金融产品</div>
            <div class="center">

                <div class="search">
                    <!-- <div class="search-item">
				<span>产品类型：</span>
				<ul>
					<li v-for="(item,index) in dataMap.tabList" :class="dataMap.tabIndex == index ? 'active' : ''"
						:key="index" @click="tab(index,item)">{{item}}</li>
				</ul>
			</div> -->
                    <div class="search-item">
                        <span>担保方式：</span>
                        <ul>
                            <li :class="dataMap.guarantee == '不限' ? 'active' : ''" :key="index" @click="tab('不限')">不限</li>
                            <li v-for="(item, index) in dataMap.LoanType" :class="dataMap.guarantee == item.value ? 'active' : ''" :key="index"
                                @click="tab(item, index)">
                                {{ item.note }}
                            </li>
                        </ul>
                    </div>
                    <!-- <div class="search-item">
				<span>产品期限：</span>
				<ul>
					<li v-for="(item,index) in dataMap.timeList" :class="dataMap.timeIndex == index ? 'active' : ''"
						:key="index" @click="tab2(index,item)">{{item}}</li>
				</ul>
			</div>
			<div class="search-item">
				<span>产品额度：</span>
				<ul>
					<li v-for="(item,index) in dataMap.quotaList" :class="dataMap.quotaIndex == index ? 'active' : ''"
						:key="index" @click="tab3(index,item)">{{item}}</li>
				</ul>
			</div> -->
                </div>

                <div class="wrapper-con" v-if="dataMap.listData.length">
                    <h3>
                        所有产品
                        <span>{{ dataMap.total }}个</span>
                    </h3>
                    <div class="con-list">
                        <div class="con-item" v-for="item in dataMap.listData" @click="toPage('/bigScreen/bankDetail?id=' + item.id)">
                            <div class="search_box_bottom_content_item_left">
                                <div class="title">
                                    {{ item.name }}
                                    <span v-if="item.isTop&&item.isTop.value==1" style="margin-right: 20px;">置顶</span>
                                </div>
                                <div class="msg">
                                    <p>
                                        所属银行：
                                        <span>{{ item.bank }}</span>
                                    </p>
                                    <p>
                                        产品期限：
                                        <span>{{ item.term }}</span>
                                    </p>
                                    <p>
                                        产品额度：
                                        <span>{{ item.quota }}</span>
                                    </p>
                                    <p>
                                        担保方式：
                                        <span>{{ item.guarantees }}</span>
                                    </p>
                                </div>
                            </div>
                            <div class="search_box_bottom_content_item_right">详情</div>
                            <!-- <span>支持方式：其他</span><span>支持产业：高端装备制造</span> -->
                            <!-- <div class="msg"></div> -->
                        </div>
                    </div>
                </div>
                <div class="page" v-if="dataMap.listData.length">
                    <a-pagination :showSizeChanger='false' v-model:current="dataMap.number" v-model:pageSize="dataMap.size" :total="dataMap.total"
                        @change="onShowSizeChange" />
                </div>
                <noData v-else style="padding-bottom: 20px;" />
            </div>
        </div>
    </div>
</template>

<script setup>
// import { policyList } from "../../api/"

import noData from '../../../no-data.vue'
import { getProductList, getLoanProductVouch } from '../../../../../api/capital'

import { ref, reactive, onMounted, toRaw } from 'vue'
import { useRouter } from 'vue-router'

const emit = defineEmits(['on-click'])
const router = useRouter()
function toPage(url) {
    //   document.querySelector(".header-box").scrollIntoView()
    router.push(url)
}
const dataMap = reactive({
    tabIndex: 0,
    size: 10,
    number: 1,
    listData: [{ isTop: { value: '0' } }],
    LoanType: [],
    // tabList: ['不限', '银行信贷', '担保金融', '小贷公司'],
    // levelList: ['不限', '信用', '质押', '抵押', '担保'],
    // timeList: ['6月以下', '12个月', '2个月以下', '24个月以下', '36个月以下'],
    // quotaList: ['200万以下', '300万以下', '500万以下', '1000万以下', '2500万以下', '3000万以下', '5000万以下', '2000万以下', '8000万以下'],
    total: 0,
    title: '',
    guarantee: '不限',
})
const getList = () => {
    console.log(dataMap.guarantee)
    getProductList({
        size: dataMap.size,
        number: dataMap.number,
        guarantee: dataMap.guarantee == '不限' ? '' : dataMap.guarantee,
    }).then((res) => {
        dataMap.listData = res.data.list
        dataMap.total = res.data.total
    })
}

const getLoanProductVouchM = () => {
    getLoanProductVouch().then((res) => {
        dataMap.LoanType = res.data
    })
}
const tab = (item) => {
    // dataMap.tabIndex = index
    if (item == '不限') {
        dataMap.guarantee = '不限'
    } else {
        dataMap.guarantee = item.value
    }
    dataMap.number = 1
    // dataMap.size = 10
    getList()
}
const onShowSizeChange = (current, pageSize) => {
    dataMap.number = current
    dataMap.size = pageSize
    getList()
    console.log(current, pageSize)
}
const searchBox = () => {
    getList()
    console.log(current, pageSize)
}
const toDetail = (id) => {
    router.push({
        path: '/supermarket/detail',
        query: {
            id: id,
        },
    })
    // emit('on-click',id)
}
const gotoHome = (act) => {
    router.push({
        path: '/bigScreenIndex',
    })
}
const backToOne = (act) => {
    router.go(-1)
}

const goBack = () => {
    router.push('/chart')
}
onMounted(() => {
    getList()
    getLoanProductVouchM()
})
</script>

<style scoped lang="scss">
@font-face {
    font-family: "ffa";
    src: url(../../../assets/bigScreen/fonts/DS-DIGIB.TTF);
}
ul,
li {
    list-style: none;
}
.big-box {
    background-color: #071c3b;
    height: 100vh;
}
.header {
    position: relative;
    text-align: center;
    position: relative;
    height: 19.1rem;

    .backBox {
        position: absolute;
        top: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 70rem;
        height: 10rem;
        cursor: pointer;
    }

    > img {
        width: 100%;
        max-height: 100%;
        margin-top: -1.1rem;
        image-rendering: -moz-crisp-edges; /* Firefox */
        image-rendering: -o-crisp-edges; /* Opera */
        image-rendering: -webkit-optimize-contrast; /* Webkit (non-standard naming) */
        image-rendering: crisp-edges;
        -ms-interpolation-mode: nearest-neighbor; /* IE (non-standard property) */
    }
}
.centerBox {
    width: 96%;
    margin: 0 auto;
    position: absolute;
    top: 14rem;
    left: 2%;
    .sreenTitle {
        background-image: url("../../../../../assets/bigScreen/sreenTitle.png");
        background-size: 100% 100%;
        height: 3.8rem;
        padding-left: 35px;
        font-weight: 600;
        color: #fff;
        display: flex;
        align-items: center;
    }
    .center {
        margin-top: 1rem;
        height: calc(100vh - 20rem);
        border: 1px solid;
        border-image: linear-gradient(
                130deg,
                #2385df 0%,
                rgba(35, 133, 223, 0.65) 92%
            )
            1;
        overflow-y: scroll;
        padding: 20px;

        .search {
            width: 135rem;
            margin: 3rem auto 0;
            padding-bottom: 1rem;

            .search-item {
                display: flex;

                margin-bottom: 2rem;

                span {
                    color: rgba(255, 255, 255, 0.8);
                    font-size: 1.6rem;
                    margin-right: 1.5rem;
                }

                ul {
                    display: flex;

                    li {
                        color: #fff;
                        font-size: 1.6rem;
                        margin-right: 2.5rem;
                        padding: 0.2rem 1.5rem;
                        cursor: pointer;
                    }

                    .active {
                        // font-weight: bold;
                        background: #037AFF;
                        // padding: .2rem 1.5rem;
                        border-radius: 0.2rem;
                    }
                }
            }
        }

        .search-box {
            display: flex;
            justify-content: center;
            align-items: center;
            width: 135rem;
            margin: 0 auto;

            .search-input {
                position: relative;

                input {
                    padding-left: 5rem;
                    width: 53rem;
                    border-radius: 17rem;
                    height: 6.4rem !important;
                    line-height: 6.4rem !important;
                    background: rgba(255, 255, 255, 0.6);
                    border: 2px solid #d5e4ff;
                    font-size: 1.6rem;
                }

                img {
                    position: absolute;
                    width: 2.5rem;
                    height: 2.5rem;
                    top: 2rem;
                    left: 2rem;
                }
            }

            .search-all {
                margin-left: 4rem;
                display: flex;
                justify-content: center;
                align-items: center;
                flex-direction: column;
                color: #035fff;
                font-size: 1.6rem;

                img {
                    width: 7.4rem;
                    height: 4rem;
                }
            }
        }

        .wrapper-con {
            width: 135rem;
            margin: 0 auto;
            // border-left: 2px solid #fff;
            // border-right: 2px solid #fff;
            padding: 0 2rem 3rem 2rem;

            h3 {
                font-size: 1.4rem;
                color: rgba(255, 255, 255);
                margin-bottom: 1rem;
                padding-top: 1rem;

                span {
                    color: #035fff;
                }
            }

            .con-list {
                // background: #f8faff;

                .con-item {
                    margin-bottom: 1.6rem;
                    background: #082853;
                    border: 1px solid #4494FF46;
                    padding: 2rem;
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    cursor: pointer;

                    .title {
                        font-size: 1.8rem;
                        color: #fff;
                        font-weight: bold;
                        margin-bottom: 1rem;
                        display: flex;
                        justify-content: space-between;

                        span {
                            font-size: 1.6rem;
                            color: #ff9f9f;
                            text-align: right;
                            font-weight: normal;
                        }
                    }

                    .msg {
                        color: rgba(255, 255, 255, 0.9);
                        margin-bottom: 1rem;
                        // margin-left: 1rem;
                        display: flex;

                        p {
                            margin-right: 6rem;
                        }

                        span {
                        color: rgba(255, 255, 255, 0.9);
                        }
                    }
                }
            }
        }

        .page {
            width: 100%;
            padding-bottom: 4rem;
            text-align: center;
        }

        .search_box_bottom_content_item_left {
            width: calc(100% - 14rem);
        }
        .search_box_bottom_content_item_right {
            width: 14rem;
            height: 4.8rem;
            background: #037dff;
            border-radius: 4px;
            color: #ffffff;
            font-size: 1.8rem;
            text-align: center;
            line-height: 4.8rem;
            margin: 0 auto;
            // margin-top: 4rem;
        }
    }
    ::-webkit-scrollbar {
        width: 5px;
        height: 10px;
    }

    /* 滚动条轨道 */
    ::-webkit-scrollbar-track {
        background-color: #234470;
    }

    /* 滚动条滑块 */
    ::-webkit-scrollbar-thumb {
        background-color: #061c57;
    }

    /* 鼠标悬停在滚动条上的滑块 */
    ::-webkit-scrollbar-thumb:hover {
        background-color: #555;
    }
}
.backToBox {
    position: absolute;
    top: 8rem;
    right: 2%;
    display: flex;
    .backTo {
        background-image: url("../../../../../assets/bigScreen/backTo.png");
        color: #2dccff;
        background-size: 100% 100%;
        width: fit-content;
        padding: 2px 40px 10px 10px;
        font-weight: 600;
        cursor: pointer;
        margin-left: 10px;
        div {
            padding-top: 5px;
        }
    }
}
::v-deep {
    .ant-btn-primary {
        border-color: #037aff;
        background: #037aff;
    }

    .ant-input {
        background: rgba(68, 148, 255, 0.12);
        border: none;
        color: #ffffff;
    }

    .ant-pagination-item {
        background: rgba(8, 26, 48, 0.8);
        border: 1px solid #0b2f5f;
    }

    .ant-pagination-item a {
        color: #ffffff;
    }

    .ant-pagination-prev .ant-pagination-item-link,
    .ant-pagination-next .ant-pagination-item-link {
        background: rgba(8, 26, 48, 0.8);
        border: 1px solid #0b2f5f;
        color: #707981;
    }

    .ant-pagination-disabled .ant-pagination-item-link {
        background: rgba(8, 26, 48, 0.8);
        border: 1px solid #0b2f5f;
        color: #707981;
    }

    .ant-pagination-item-active {
        background: #004dfd;
        border-radius: 2px;
        border: none;
    }

    .ant-pagination-jump-prev
        .ant-pagination-item-container
        .ant-pagination-item-ellipsis,
    .ant-pagination-jump-next
        .ant-pagination-item-container
        .ant-pagination-item-ellipsis {
        color: #ffffff;
    }
    .ant-select-selector {
        background-color: transparent !important;
        background: rgba(8, 26, 48, 0.8) !important;
        border: 1px solid #0b2f5f !important;
        color: #ffffff !important;
    }
}
</style>
